
# 指定要检测的端口号
PORT=8088
DEFAULT_MODEL_PATH=/mnt/publish-data/train_data/Qwen-1_8B-Chat/


if [ -z $MODEL_PATH ];then
    MODEL_PATH=$DEFAULT_MODEL_PATH
    echo "using dafault model path"
fi

nohup python openai_api.py --server-port $PORT --server-name 0.0.0.0 -c $MODEL_PATH  &
while true; do
  # 使用netstat检测端口是否开启
  netstat -an | grep LISTEN | grep ":$PORT"
  # 检查命令的返回状态码
  if [ $? -eq 0 ]; then
    echo "端口 $PORT 已经开启"
    break
  else
    echo "waiting port $PORT"
    sleep 2
  fi

done

gunicorn app:app -b 0.0.0.0:8080  -w 4 -k  gevent --log-level debug